﻿using System;
using System.Windows;
using CloudClipboardSync.Model;
using Hardcodet.Wpf.TaskbarNotification;

namespace CloudClipboardSync
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App
    {
        public static TaskbarIcon SystrayIcon { get { return Current.FindResource("systrayIcon") as TaskbarIcon; } }
        public static ProgramData ProgramData { get { return Current.FindResource("programData") as ProgramData; } }

        private void ApplicationStartup(object sender, StartupEventArgs e)
        {
            Current.DispatcherUnhandledException += (s, eventArgs) => { eventArgs.Handled = true; MessageBox.Show(eventArgs.Exception.ToString()); };
            AppDomain.CurrentDomain.UnhandledException += (s, eventArgs) => MessageBox.Show(eventArgs.ExceptionObject.ToString());

            ProgramData.OnApplicationStarted();
        }
    }
}
